﻿using System;
using COC.CComponent;
using COC.Character;
using COC.Character.Behave;
using COC.Debug;
using COC.Tools.AI.Motion;
using UnityEngine;
using System.Collections;
namespace COC.Character
{
    public class CharacterProfile : BaseComponent
    {

        BaseValueModel profile;
        GameObject health;
        GameObject healthUI;
        Animator animator;
        AIBehave aiBehave;
        

        private BaseValueModel _profile
        {
            get
            {
                return profile;
            }
            set
            {
                if (value == null) return;
                _profile = value;
                profile = _profile;
            }
        }

        /// <summary>
        /// inject a health component if need
        /// </summary>
        public GameObject _health
        {
            get
            {
                return health;
            }
            set
            {
                if (value == null) return;

                health = value;

            }
        }

        public AIBehave _aiBehave
        {
            get
            {
                return aiBehave;
            }
            set
            {
                if (value == null) return;

                aiBehave = value;

            }
        }

        #region initialize data when instance a type of the class at runtime
        //input profile 
        public void setProfile(BasePlayValueModel pro)
        {
            _profile = (BaseValueModel)pro;

        }
        public GameObject _healthUI
        {
            get
            {
                return healthUI;
            }
            set
            {
                if (value == null) return;

                healthUI = value;

            }
        }
      
        
        #endregion
        #region adjust UI to diplay a appropriate local.
        public void adjustHealth(Vector3 mousePos,Vector3 posOffset,Vector3 scale,Vector3 rotation)
        {

            health.transform.localScale = new Vector3(0.2f, 0.5f, 0.5f);
            health.transform.position = mousePos + new Vector3(20, 0, 150);
        }

        #endregion
        #region interaction relation data


        public void changeState(CHARACTER_STATE state)
        {
            profile.__state = (int)state;
        }


        #endregion
        public class BaseValueModel : BasePlayValueModel
        {
            
        }
    }
}